Inverted Pendulum Simulation